package cn.gailvlun.gll.presentation.emotion.drawer

import android.view.View
import cn.gailvlun.gll.R
import cn.gailvlun.gll.net.emotion.Emotion
import cn.gailvlun.gll.presentation.base.BaseActivity
import cn.gailvlun.gll.presentation.emotion.core.BaseAdapter
import cn.gailvlun.gll.presentation.emotion.core.BaseViewModel
import cn.gailvlun.gll.presentation.profile.ProfileActivity


class EmotionPersonalViewModel : BaseViewModel {

    private val mParentView: View
    override var mActivity: BaseActivity

    constructor(activity: BaseActivity, adapter: BaseAdapter<Any>) : super(activity, adapter) {
        mActivity = activity
        mParentView = layoutInflater.inflate(R.layout.activity_emotion_personal, null)
        initPopWindow(mParentView)
    }


    fun jump2Profile(item: Emotion) {
        super.baseJump2Profile(item.owner)
    }

    fun jump2MyProfile() {
        ProfileActivity.openActivity(mActivity)

    }






    fun toEmotionDetail(item: Emotion) {
        super.baseToEmotionDetail(item)

    }

    fun showReplaceBgWindow() {
        super.baseShowReplaceBgFun(mParentView)
    }

    fun showOperateEmotionWindow(view: View, item: Emotion) {
        super.baseShowOperateEmotionWindow(mParentView, item)
    }


    fun showFunction(anchor: View, emotion: Emotion) {
        super.baseShowFunction(anchor, emotion)
    }

    override fun deleteEmotionCallback(emotion: Emotion) {
        super.deleteEmotionCallback(emotion)
        listener!!.onDelete(emotion)

    }

    interface OnDeleteEmotionListener {
        fun onDelete(emotion: Emotion)
    }

    private var listener: OnDeleteEmotionListener? = null
    fun setOnDeleteEmotionListener(listener: OnDeleteEmotionListener) {
        this.listener = listener

    }

}